//PA2-1
#ifdef DATA_BYTE
#include "cpu/exec/template-start.h"

#define instr jcc

#ifndef JCC_TAKE_COND_DEFINED
#define JCC_TAKE_COND_DEFINED
static inline bool jcc_take_cond(uint32_t opcode) {
    /* low 4 bits of opcode select condition for 0x70..0x7F, and 0F 80..8F */
    uint32_t cc = opcode & 0xF;
    switch (cc) {
        case 0x0: return cpu.eflags.OF;                /* JO */
        case 0x1: return !cpu.eflags.OF;               /* JNO */
        case 0x2: return cpu.eflags.CF;                /* JB/JC/JNAE */
        case 0x3: return !cpu.eflags.CF;               /* JNB/JNC/JAE */
        case 0x4: return cpu.eflags.ZF;                /* JZ/JE */
        case 0x5: return !cpu.eflags.ZF;               /* JNZ/JNE */
        case 0x6: return cpu.eflags.CF || cpu.eflags.ZF; /* JBE/JNA */
        case 0x7: return !cpu.eflags.CF && !cpu.eflags.ZF; /* JA/JNBE */
        case 0x8: return cpu.eflags.SF;                /* JS */
        case 0x9: return !cpu.eflags.SF;               /* JNS */
        case 0xA: return cpu.eflags.PF;                /* JP/JPE */
        case 0xB: return !cpu.eflags.PF;               /* JNP/JPO */
        case 0xC: return cpu.eflags.SF != cpu.eflags.OF;  /* JL/JNGE */
        case 0xD: return cpu.eflags.SF == cpu.eflags.OF;  /* JNL/JGE */
        case 0xE: return cpu.eflags.ZF || (cpu.eflags.SF != cpu.eflags.OF); /* JLE/JNG */
        case 0xF: return !cpu.eflags.ZF && (cpu.eflags.SF == cpu.eflags.OF); /* JNLE/JG */
    }
    return false;
}
#endif

static void do_execute() {
    if (jcc_take_cond(ops_decoded.opcode)) {
        cpu.eip += op_src->val;
    }
    print_asm("jcc %x", cpu.eip + 1 + DATA_BYTE);
}

make_instr_helper(si)

#include "cpu/exec/template-end.h"
#endif


